import 'ant-design-vue/es/message/style/css';
export class Update {
    static ByFid({
        Fid,
        attr,
        service,
    }) {
        //console.log(formState.value.FID)
        //获取选中点要素FID
        /* 1、设置查询结构 */
        const queryStruct = new Zondy.Service.QueryFeatureStruct()
        queryStruct.IncludeGeometry = true
        queryStruct.IncludeWebGraphic = true
        /* 2、设置查询参数 */
        const queryParam = new Zondy.Service.QueryParameter({
            struct: queryStruct,
            objectIds: Fid,
        })
        /* 3、调用查询服务 */
        const queryService = new Zondy.Service.QueryDocFeature(
            queryParam,
            service.name, service.layerId,
            {
                ip: 'localhost',
                port: 6163,
            }
        )
        /* 4、回到 */
        queryService.query(querySuccess)
        //回调成功
        function querySuccess(result) {
            let resultPoint = result
            console.log(result);
            //设置添加点要素的属性信息
            console.log(attr[0]);
            resultPoint.SFEleArray[0].AttValue[7] = attr[0]
            /* 更改样式 */
            let color
            switch (attr[0]) {
                case 0:
                    color = 6
                    break
                case 1:
                    color = 4
                    break
                case 2:
                    color = 90
                    break
            }
            resultPoint.SFEleArray[0].GraphicInfo.PntInfo.color = color
            //创建一个编辑服务类
            var editService = new Zondy.Service.EditDocFeature(service.name, service.layerId, {
                ip: 'localhost',
                port: '6163', //访问IGServer的端口号，.net版为6163，Java版为8089
            })
            editService.update(resultPoint, (e) => {
                if (e) {
                    console.log("更新成功");
                }
                docLayer.refresh()
            })
        }
    }
}
